import {stringify} from 'qs';
import request from '@/utils/request';


export async function query(params) {
  return request(`/api/v1/role/queryByPage?${stringify(params)}`)
}

export async function remove(params) {
  return request('/api/v1/role', {
    method: 'DELETE',
    body: {
      ...params
    },
  });
}

export async function saveOrUpdate(params) {
  return request('/api/v1/role/saveOrUpdate', {
    method: 'POST',
    body: {
      ...params
    },
  });
}

export async function queryMenu(params) {
  return request(`/api/v1/menus/queryList?${stringify(params)}`)
}

export async function queryRoleMenu(params) {
  return request(`/api/v1/role/queryRoleMenu?${stringify(params)}`)
}

export async function saveRoleMenu(params) {
  let menus = params.menus;
  return request(`/api/v1/role/${params.id}/saveRoleMenus`, {
    method: 'POST',
    body: menus,
  });
}

